package com.mysoft.gfyx.common.rpc.omp;

import com.mysoft.gfyx.common.rpc.omp.dto.GetTokenResponseDto;
import feign.Headers;
import feign.Param;
import feign.RequestLine;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

//@FeignClient(name = "ucd", url = "${omp.auth-host2}", configuration = OMPAuthConfiguration.class)
public interface OMPAuthService {

    //@PostMapping(value = "/connect/token", consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE}, produces = {MediaType.ALL_VALUE})
    //GetTokenResponseDto getToken(@RequestBody  Map<String, ?> queryParam, @RequestHeader("Authorization") String token);

    @RequestLine("POST /connect/token")
    @Headers({"Content-Type: application/x-www-form-urlencoded","Authorization:{auth}"})
    GetTokenResponseDto getToken(@Param("grant_type") String grant_type, @Param("scope") String scope, @Param("auth") String token);
}
